package com.java54.wcm1;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class test12 {
	public static void main(String[] args) throws IOException {
		InputStream in = new FileInputStream("E://new.JPG");
		DataInputStream dis = new DataInputStream(in);
		dis.read();
		File f = new File("D://myDoc");
		if (!f.exists()) {
			f.mkdirs();
		}
		OutputStream out = new FileOutputStream("D://myDoc/myPicture.JPG");
		DataOutputStream dos = new DataOutputStream(out);
		int i = -1;
		while ((i = dis.read()) != -1) {
			dos.write(i);
		}
		in.close();
		dis.close();
		out.close();
		dos.close();

	}
}
